home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / sea of chaos / sea_install.msi / _15C39AAA7726369D39812BD40F01CF6A / _5CCDDAE4E32A4D39898C472393AE92DA < prev    next >
Text File  |  2005-03-04  |  906b  |  46 lines

  1. //simple per-pixel phong shading
  2.  
  3. //Luke Lenhart
  4. //(C)2004-2005 Digipen Institute of Technology
  5.  
  6. //combined world,view,projection transform
  7. float4x4 matWorldViewProj;
  8. //world transform
  9. float4x4 matWorld;
  10.  
  11. //shader input
  12. struct VS_INPUT
  13. {
  14.     float4 Pos : POSITION;
  15.     float4 Normal : NORMAL;
  16.     float2 Tex0 : TEXCOORD0;
  17. };
  18.  
  19. //shader output
  20. struct VS_OUTPUT
  21. {
  22.     float4 Pos : POSITION;
  23.     float3 Normal : TEXCOORD2;
  24.     float3 Pos2 : TEXCOORD1;
  25.     float2 Tex0 : TEXCOORD0;
  26.     float4 Clr : COLOR;
  27. };
  28.  
  29. //shader code
  30. VS_OUTPUT VShader(VS_INPUT In)
  31. {
  32.     VS_OUTPUT Out;
  33.     
  34.     //copy normal, and tex coord, set color
  35.     Out.Normal=mul(matWorld,In.Normal.xyz);
  36.     Out.Tex0=In.Tex0;
  37.     Out.Clr=float4(1,1,1,1);
  38.     
  39.     //calc transformed position
  40.     Out.Pos=mul(matWorldViewProj,In.Pos);
  41.     Out.Pos2=mul(matWorld,In.Pos);
  42.     
  43.     //spit out the results
  44.     return Out;
  45. }
  46.